package com.ym.medical.service.impl;

import com.ym.core.utils.tkmybatis.BaseSVImpl;
import com.ym.medical.dao.SubjectReplyDao;
import com.ym.medical.domain.entity.SubjectReplyEntity;
import com.ym.medical.domain.param.SubjectReplyQueryParam;
import com.ym.medical.domain.param.SubjectReplyUpdateParam;
import com.ym.medical.domain.vo.SubjectReplyListMobileVO;
import com.ym.medical.domain.vo.SubjectReplyListPcVO;
import com.ym.medical.service.ISubjectReplySV;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
                                                                                                                    
/**
* 主题回复Service业务层处理
*
* @author ym
* @date 2020-08-24
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class SubjectReplySVImpl extends BaseSVImpl<SubjectReplyEntity,SubjectReplyDao> implements ISubjectReplySV {

	/**
	 * 查询主题回复列表
	 *
	 * @param queryParam 主题回复 查询参数
	 * @return 主题回复
	 */
	@Override
	public List<SubjectReplyListPcVO> selectListPC(SubjectReplyQueryParam queryParam) {
		List<SubjectReplyListPcVO> subjectReplys = mapper.selectListPC(queryParam);
		return subjectReplys;
	}

	/**
	 * 新增主题回复
	 *
	 * @param updateParam 主题回复 新增参数
	 * @return 结果
	 */
	@Override
	public Long insertPC(SubjectReplyUpdateParam updateParam) {
            SubjectReplyEntity entity = updateParam.covert();
		this.insert(entity);
		return entity.getId();
	}

	/**
	 * 修改主题回复
	 *
	 * @param updateParam 主题回复 修改参数
	 * @return 结果
	 */
	@Override
	public int updateByIdPC(SubjectReplyUpdateParam updateParam) {
            SubjectReplyEntity entity = updateParam.covert("createTime");
		int result = this.updateById(entity);
		return result;
	}

	/**
	 * 主题答复
	 * @param id
	 * @param loginId
	 * @return
	 */
	@Override
	public List<SubjectReplyListMobileVO> getSubjectReplyDetail(Long id, Long loginId) {
		return mapper.getSubjectReplyDetail(id,loginId);
	}
}
